<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>弓友之家</title>
    <link rel="stylesheet" href="css/mui.css" />
    <link rel="stylesheet" href="fonts/iconfont.css" />
    <link rel="stylesheet" href="css/style.css" />
    <style>
    	.index-serach{padding: 0 15px 0 0;}
    	.index-serach form{margin-top: 7px;}
    </style>
</head>
<body>
	<header class="mui-bar mui-bar-nav index-serach">
		<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		<form class="mui-pull-right">
			<input type="text" id="keys" placeholder="输入您想要查找的内容" />
			<select id="type">
				<option data-type="2">会员</option>
				<option data-type="1">商品</option>
				<option data-type="3">文章</option>
			</select>
			<button type="button" onclick="search()" class="iconfont icon-sousuo"></button>
		</form>
	</header>
	<div class="mui-content">
		<div class="searchmember">
			<div class="head mui-clearfix mui-row">
				<div class="mui-col-xs-6 on">
					<span></span>
					<select id="city">
					</select>
					<i class="mui-icon mui-icon-arrowdown"></i>
				</div>
				<div class="mui-col-xs-6">
					<span></span><font class="mui-pull-left">阿米尔战队</font>
				</div> 
			</div>
			<div class="searchmember-content">
				<div class="con con1">
					<ul class="mui-table-view">
					</ul>
				</div>
				<div class="con con2 mui-hidden">
					<ul class="mui-table-view">
					</ul>
				</div>
			</div>
		</div>
	</div>
	<br />
	<script type="text/javascript" src="js/mui.min.js" ></script>
	<script type="text/javascript" src="js/jquery-1.8.3.min.js" ></script>
	<script type="text/javascript" src="js/common.js" ></script>
	<script type="text/javascript" charset="utf-8">
      	mui.init();
      	var keys="";
      	mui.ajax(H_SRC+'/amier/index/pro_list',{
			data:{
				token:token
			},
			dataType:'json',
			type:'post',
			timeout:10000,             
			success:function(data){
				var dataurl=data.data;
				var catyid="";
				if(data.code == 1){
					var city="";
					for(var i=0;i<dataurl.length;i++){
						if(dataurl[i].namecn=="河南省"){
							catyid=dataurl[i].id;
						}
						city+='<option value="'+dataurl[i].id+'">'+dataurl[i].namecn+'</option>'
					} 
					$("#city").html(city);
					$("#city").find("option[value = '"+catyid+"']").attr("selected","selected");
					keys=$("#city").children('option:selected').val();
					selectMember(keys);
					$("#city").change(function(){
						keys=$("#city").children('option:selected').val();
						selectMember(keys);
					})
				}else{
					mui.toast(data.msg);
				}
			},
			error:function(){
				
			}
		}) 
		mui.ajax(H_SRC+'/amier/index/corps',{
			data:{
				token:token,
			},
			dataType:'json',
			type:'post',
			timeout:10000,             
			success:function(data){
				var dataurl=data.data.amier_team_list;
				if(data.code == 1){
					var member="";
					for(var i=0;i<dataurl.length;i++){ 
						member+='<li class="mui-table-view-cell"><a data-id="'+dataurl[i].id+'">'+dataurl[i].name+'</a></li>';
					}
					$(".con2 ul").html(member);
				}else{
					mui.toast(data.msg);
				}
			},
			error:function(){
				
			}
		})  
		
		function selectMember(keys){
			mui.ajax(H_SRC+'/amier/index/find_team_by_province',{
				data:{
					token:token,
					id:keys
				},
				dataType:'json',
				type:'post',
				timeout:10000,             
				success:function(data){
					var dataurl=data.data;
					if(data.code == 1){
						var member="";
						for(var i=0;i<dataurl.length;i++){
							member+='<li class="mui-table-view-cell"><a data-id="'+dataurl[i].id+'">'+dataurl[i].name+'</a></li>';
						}
						$(".con1 ul").html(member);
					}else{
						mui.toast(data.msg);
					}
				},
				error:function(){
					
				}
			})  
		}
		
		$(".con1").on("tap","a",function(){ 
      		var mid=$(this).attr("data-id");
      		mui.openWindow({
				url:'searchmember-page1.html',
				id:'searchmember-page1.html',
				createNew:true,
				show: {
					autoShow: true,
					aniShow: 'slide-in-right',
					duration: 200
				},
				extras:{
					mid:mid
				}
			});
      	})
		$(".con2").on("tap","a",function(){ 
      		var mid=$(this).attr("data-id");
      		mui.openWindow({
				url:'searchmember-page2.html',
				id:'searchmember-page2.html',
				createNew:true,
				show: {
					autoShow: true,
					aniShow: 'slide-in-right',
					duration: 200
				},
				extras:{
					mid:mid
				}
			});
      	})
		
		function search(){
      		var keys=$("#keys").val();
      		if(keys==""){
      			mui.toast("搜索内容不能为空");
      			return false;
      		}
      		var type=$("#type").children("option:selected").attr("data-type");
      		mui.openWindow({
				url:'search.html',
				id:'search.html',
				createNew:true,
				extras:{
					keys:keys,
					type:type
				},
				show: {
					autoShow: true,
					aniShow: 'slide-in-right',
					duration: 200
				}
			});
      	}
		
		$(".searchmember .head .mui-col-xs-6").on("tap",function(){
			var a=$(this).index();
			$(".searchmember .head .mui-col-xs-6").eq(a).addClass("on").siblings().removeClass("on");
			$(".searchmember-content .con").eq(a).removeClass("mui-hidden").siblings().addClass("mui-hidden");
		})
    </script>
</body>
</html>